/*
 * @Author: fisher
 * @Date: 2023-11-13 11:29:47
 * @LastEditTime: 2023-11-13 11:29:50
 * @LastEditors: fisher
 * @Description:
 * @FilePath: \FCT\src\utils\FCT\utils.js
 */

/**
 * @description: 屏幕坐标转经纬度坐标
 * @param {*} position
 * @return {*}
 */
export const screen2degrees = (p) => {
  const ray = viewer.camera.getPickRay(p);
  let cartesian3 = viewer.scene.globe.pick(ray, viewer.scene);
  var cartographic = Cesium.Cartographic.fromCartesian(cartesian3);
  var lat = Cesium.Math.toDegrees(cartographic.latitude);
  var lng = Cesium.Math.toDegrees(cartographic.longitude);
  var height = cartographic.height;
  return {
    x: lng,
    y: lat,
    z: height,
  };
};
